package org.cuijq.thinking.in.spring.bean.definition;

import org.cuijq.thinking.in.spring.ioc.domain.User;
import org.springframework.beans.MutablePropertyValues;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.beans.factory.support.BeanDefinitionBuilder;
import org.springframework.beans.factory.support.GenericBeanDefinition;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 *  BeanInstantiationDemo 构建
 */
public class BeanInstantiationDemo {
    public static void main(String[] args) {
        BeanFactory beanFactory = new ClassPathXmlApplicationContext("classpath:/META-INF/bean-creation-context.xml");
        User user =beanFactory.getBean("user-by-static-method", User.class);
        User user2 =beanFactory.getBean("user-by-instance-method", User.class);
        User user3 =beanFactory.getBean("user-by-factory-bean", User.class);

        System.out.println(user);
        System.out.println(user2);
        System.out.println(user3);


        System.out.println(user==user2);
        System.out.println(user==user3);
    }


}
